// ex8_8_5.cpp
#include <iostream>

template<class T>
T max5(T arr[]);
int main(void)
{
    int arr[] = {2, 1, 3, 109, 4};
    double arr2[] = {2.1, 1.3, 3.5, 9.2, 4.7};
    std::cout << max5(arr) << "\n";
    std::cout << max5(arr2) << "\n";
    return 0;
}

template<class T>
T max5(T arr[])
{
     unsigned int idx_max = 0;
    for (unsigned int i = 0; i < 5; i++)
    {
        if (arr[idx_max] < arr[i])
                idx_max = i;
    }
    return arr[idx_max];
}
